package com.cskaoyan.controller.wx;

import com.cskaoyan.model.admin.vo.BaseRespVo;
import com.cskaoyan.model.vx.bo.WxFeedbackBo;
import com.cskaoyan.service.wx.WxFeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * @author hanshuai
 * @version 1.0
 * @description @TODO
 * @date 2021/12/2 22:40
 */
@RestController
@RequestMapping("wx/feedback")
public class WxFeedbackController {
    @Autowired
    WxFeedbackService wxFeedbackService;

    @RequestMapping("/submit")
    public BaseRespVo feedbackSubmit(@RequestBody  WxFeedbackBo wxFeedbackBo, HttpSession httpSession) {
        if (wxFeedbackBo.getMobile().length() != 11) {
            return BaseRespVo.fail(401, "参数不对");
        }
        try {
            Long.parseLong(wxFeedbackBo.getMobile());
        } catch (Exception e) {
            return BaseRespVo.fail(401, "参数不对");
        }
        wxFeedbackService.feedbackSubmit(wxFeedbackBo,httpSession);
        return BaseRespVo.ok(null);
    }
}
